home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 November / Freeware November 1998.img / dist / fw_UDELxntp.idb / usr / freeware / src / xntp-3.4o-export / lib / netof.c.z / netof.c
C/C++ Source or Header  |  1998-01-21  |  432b  |  25 lines

  1. /* 
  2.  * netof - return the net address part of an ip address
  3.  *         (zero out host part)
  4.  */
  5. #include <stdio.h>
  6.  
  7. #include "ntp_fp.h"
  8. #include "ntp_stdlib.h"
  9.  
  10. u_int32
  11. netof(num)
  12.     u_int32 num;
  13. {
  14.     register u_int32 netnum;
  15.  
  16.     netnum = num;
  17.     if(IN_CLASSC(netnum))
  18.         netnum &= IN_CLASSC_NET;
  19.     else if (IN_CLASSB(netnum))
  20.         netnum &= IN_CLASSB_NET;
  21.     else            /* treat all other like class A */
  22.         netnum &= IN_CLASSA_NET;
  23.     return netnum;
  24. }
  25.